<!--
 * @Description: 
 * @Author: yongLin
 * @Date: 2023-01-05 11:20:31
 * @LastEditTime: 2023-01-09 14:45:40
 * @LastEditors: yongLin
-->
<template>
  <view class="mine">
    <view class="mine-header">
      <view class="h-item">
        <image class="l-avatar" src="" />
        <text class="l-name">小兔</text>
      </view>
      <view class="h-item" @click="toCollection">
        <view class="i-icon iconfont icon-aixin"></view>
        <text class="i-text">我的收藏</text>
      </view>
      <view class="h-item">
        <view class="i-icon iconfont icon-yuyueguanli"></view>
        <text class="i-text">我的预约</text>
      </view>
      <view class="h-item" @click="toDaybook">
        <view class="i-icon iconfont icon-yuyueguanli"></view>
        <text class="i-text">我的流水</text>
      </view>
    </view>
    <view class="card">
      <view class="c-title">我的收藏</view>
      <view class="c-content">
        <u-empty
          v-if="!list1.length"
          icon="../../../../static/icon_empty_01.png"
          text="列表暂无信息"
        />
        <u-cell-group v-else>
          <u-cell
            v-for="(item, i) in list1"
            :key="i"
            :title="item.name"
            :isLink="true"
            arrow-direction="right"
          ></u-cell>
        </u-cell-group>
      </view>
    </view>
    <view class="card">
      <view class="c-title">我的预约</view>
      <view class="c-content">
        <u-empty
          v-if="!list1.length"
          icon="../../../../static/icon_empty_01.png"
          text="列表暂无信息"
        />
        <u-cell-group>
          <u-cell
            v-for="(item, i) in list1"
            :key="i"
            :title="item.name"
            :label="`预约时间：${item.time}`"
          >
            <template slot="value">
              <view v-if="item.status === '0'" class="btn btn--gray"
                >待确认</view
              >
              <view v-if="item.status === '1'" class="btn btn--green"
                >已确认</view
              >
              <view v-if="item.status === '2'" class="btn btn--red"
                >已取消</view
              >
              <view v-if="item.status === '3'" class="btn btn--yellow"
                >已改期</view
              >
            </template>
          </u-cell>
        </u-cell-group>
      </view>
    </view>
    <u-loadmore status="nomore" nomoreText="已经到底了" line />
  </view>
</template>

<script>
export default {
  data() {
    return {
      list1: [
        { name: "房源1", time: "2021-01-12 12:01", status: "0" },
        { name: "房源1", time: "2021-01-12 12:01", status: "1" },
        { name: "房源1", time: "2021-01-12 12:01", status: "2" },
        { name: "房源1", time: "2021-01-12 12:01", status: "3" },
      ],
    };
  },
  methods: {
    toCollection() {
      uni.navigateTo({
        url: "/pages/tabbar/mine/collection/collection",
      });
    },
    toDaybook() {
      uni.navigateTo({
        url: "/pages/tabbar/daybook/index",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.mine {
  height: 100%;
  padding: 30rpx;
  background: #f7f7f8;

  &-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 32rpx;
    margin: 0 auto 30rpx;
    background-color: #fff;
    border-radius: 10rpx;

    .h-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      &:nth-child(2) {
        margin-left: 80rpx;
      }
      .l-avatar {
        width: 100rpx;
        height: 100rpx;
        margin-bottom: 10rpx;
        background-color: #000;
        border-radius: 50%;
      }
      .i-name {
        font-size: 36rpx;
        font-weight: bold;
      }
      .i-icon {
        width: 70rpx;
        height: 70rpx;
        margin-bottom: 20rpx;
        font-size: 58rpx;
        color: #fff;
        text-align: center;
        line-height: 70rpx;
        background: #2489ff;
        border-radius: 50%;
      }
      .i-text {
        font-size: 28rpx;
        font-weight: 500;
      }
    }
  }

  .card {
    width: 100%;
    padding: 32rpx;
    background-color: #fff;
    margin-bottom: 30rpx;
    .c-title {
      font-size: 36rpx;
      font-weight: bold;
      color: #333444;
      margin-bottom: 30rpx;
    }
    .c-content {
      font-size: 26rpx;
      font-weight: 500;
      color: #888999;
      line-height: 36rpx;
    }
  }
  .btn {
    width: 100rpx;
    height: 50rpx;
    font-size: 24rpx;
    text-align: center;
    line-height: 45rpx;
    border-radius: 8rpx;
    &--gray {
      color: #85888e;
      border: 1rpx solid #85888e;
      background: #f2f2f3;
    }
    &--green {
      color: #7ac756;
      border: 1rpx solid #7ac756;
      background: #eef8e8;
    }
    &--yellow {
      color: #e29836;
      border: 1rpx solid #e29836;
      background: #fdf5e9;
    }
    &--red {
      color: #f26161;
      border: 1rpx solid #f26161;
      background: #feeeee;
    }
  }

  ::v-deep .u-loadmore {
    margin-top: 30rpx !important;
  }
}
</style>
